#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <aclconio.h>
#include <define.h>
#include <transact.h>
#include <tran.h>
#include <gds.h>
#include <sizes.h>
#include "ConfProto.h"
#include "tblutil.h"
#include <\SOFTPAY\Ver30\source\include\sizes.h>
#include <\SOFTPAY\Ver30\HostSrc\citisrc\citiids.h>
#include <\SOFTPAY\Ver30\HostSrc\cpacsrc\cpacids.h>
#include <confio.h>

#include <\SOFTPAY\Ver30\source\include\TCP.h>

const char*TCPName = "TCP.dat";

static TCP_REC srTCPRec;

static int recordNum;
int	inLoadTCPRec (int inRecNumber)
{
	int inRet;

	inRet = inLoadConfRec(TCP_FILENAME, SIZE_TCP_REC, inRecNumber, (char *) &srTCPRec);

	recordNum = inRecNumber;
	return inRet;
}

void *pvdGetTCPRec(void)
{
	return &srTCPRec;

}

int	inSaveTCPRec (int inRecNumber)
{
	int inRet;

	inRet = inSaveConfRec(TCP_FILENAME, SIZE_TCP_REC, inRecNumber, (char *) &srTCPRec);

	return inRet;
}

int	inGetTCPRecNumber (void)
{
	return recordNum;
}

int	inUpdateTCPRec (void)
{
	int inRet;

	inRet = inSaveConfRec(TCP_FILENAME, SIZE_TCP_REC, recordNum, (char *) &srTCPRec);

	return inRet;
}

void	vdResetTCPRec (void)
{
	memset((void*)&srTCPRec, 0, REC_SIZEOF(srTCPRec));
}

char* szGetHostPrimaryIP(void)
{
	return srTCPRec.szHostPrimaryIP;
}

void vdSetHostPrimaryIP(const char* szHostPrimaryIP)
{
	strNumCopy(srTCPRec.szHostPrimaryIP, szHostPrimaryIP, sizeof(((TCP_REC*)NULL)->szHostPrimaryIP)-1);
}

char* szGetHostSecondaryIP(void)
{
	return srTCPRec.szHostSecondaryIP;
}

void vdSetHostSecondaryIP(const char* szHostSecondaryIP)
{
	strNumCopy(srTCPRec.szHostSecondaryIP, szHostSecondaryIP, sizeof(((TCP_REC*)NULL)->szHostSecondaryIP)-1);
}

char* szGetMyIP(void)
{
	return srTCPRec.szMyIP;
}

void vdSetMyIP(const char* szMyIP)
{
	strNumCopy(srTCPRec.szMyIP, szMyIP, sizeof(((TCP_REC*)NULL)->szMyIP)-1);
}

char* szGetGateWay(void)
{
	return srTCPRec.szGateWay;
}

void vdSetGateWay(const char* szGateWay)
{
	strNumCopy(srTCPRec.szGateWay, szGateWay, sizeof(((TCP_REC*)NULL)->szGateWay)-1);
}

char* szGetSubNetMask(void)
{
	return srTCPRec.szSubNetMask;
}

void vdSetSubNetMask(const char* szSubNetMask)
{
	strNumCopy(srTCPRec.szSubNetMask, szSubNetMask, sizeof(((TCP_REC*)NULL)->szSubNetMask)-1);
}

char* szGetHostDNS1(void)
{
	return srTCPRec.szHostDNS1;
}

void vdSetHostDNS1(const char* szHostDNS1)
{
	strNumCopy(srTCPRec.szHostDNS1, szHostDNS1, sizeof(((TCP_REC*)NULL)->szHostDNS1)-1);
}

char* szGetHostDNS2(void)
{
	return srTCPRec.szHostDNS2;
}

void vdSetHostDNS2(const char* szHostDNS2)
{
	strNumCopy(srTCPRec.szHostDNS2, szHostDNS2, sizeof(((TCP_REC*)NULL)->szHostDNS2)-1);
}

char* szGetWiFiSysID(void)
{
	return srTCPRec.szWiFiSysID;
}

void vdSetWiFiSysID(const char* szWiFiSysID)
{
	strNumCopy(srTCPRec.szWiFiSysID, szWiFiSysID, sizeof(((TCP_REC*)NULL)->szWiFiSysID)-1);
}

char* szGetWiFiWEPKeyVal1(void)
{
	return srTCPRec.szWiFiWEPKeyVal1;
}

void vdSetWiFiWEPKeyVal1(const char* szWiFiWEPKeyVal1)
{
	strNumCopy(srTCPRec.szWiFiWEPKeyVal1, szWiFiWEPKeyVal1, sizeof(((TCP_REC*)NULL)->szWiFiWEPKeyVal1)-1);
}

char* szGetWiFiWEPKeyVal2(void)
{
	return srTCPRec.szWiFiWEPKeyVal2;
}

void vdSetWiFiWEPKeyVal2(const char* szWiFiWEPKeyVal2)
{
	strNumCopy(srTCPRec.szWiFiWEPKeyVal2, szWiFiWEPKeyVal2, sizeof(((TCP_REC*)NULL)->szWiFiWEPKeyVal2)-1);
}

char* szGetWiFiWEPKeyVal3(void)
{
	return srTCPRec.szWiFiWEPKeyVal3;
}

void vdSetWiFiWEPKeyVal3(const char* szWiFiWEPKeyVal3)
{
	strNumCopy(srTCPRec.szWiFiWEPKeyVal3, szWiFiWEPKeyVal3, sizeof(((TCP_REC*)NULL)->szWiFiWEPKeyVal3)-1);
}

char* szGetWiFiWEPKeyVal4(void)
{
	return srTCPRec.szWiFiWEPKeyVal4;
}

void vdSetWiFiWEPKeyVal4(const char* szWiFiWEPKeyVal4)
{
	strNumCopy(srTCPRec.szWiFiWEPKeyVal4, szWiFiWEPKeyVal4, sizeof(((TCP_REC*)NULL)->szWiFiWEPKeyVal4)-1);
}

short inGetIPType(void)
{
	return srTCPRec.inIPType;
}

void vdSetIPType(short inIPType)
{
	srTCPRec.inIPType = inIPType;
}

short inGetIPEnable(void)
{
	return srTCPRec.inIPEnable;
}

void vdSetIPEnable(short inIPEnable)
{
	srTCPRec.inIPEnable = inIPEnable;
}

short inGetIPTCPTO(void)
{
	return srTCPRec.inIPTCPTO;
}

void vdSetIPTCPTO(short inIPTCPTO)
{
	srTCPRec.inIPTCPTO = inIPTCPTO;
}

short inGetWiFiICReset(void)
{
	return srTCPRec.inWiFiICReset;
}

void vdSetWiFiICReset(short inWiFiICReset)
{
	srTCPRec.inWiFiICReset = inWiFiICReset;
}

short shGetIPPort(void)
{
	return srTCPRec.shIPPort;
}

void vdSetIPPort(short shIPPort)
{
	srTCPRec.shIPPort = shIPPort;
}

short shGetIPTries(void)
{
	return srTCPRec.shIPTries;
}

void vdSetIPTries(short shIPTries)
{
	srTCPRec.shIPTries = shIPTries;
}

short shGetIPPingMins(void)
{
	return srTCPRec.shIPPingMins;
}

void vdSetIPPingMins(short shIPPingMins)
{
	srTCPRec.shIPPingMins = shIPPingMins;
}

short shGetWiFiChannel(void)
{
	return srTCPRec.shWiFiChannel;
}

void vdSetWiFiChannel(short shWiFiChannel)
{
	srTCPRec.shWiFiChannel = shWiFiChannel;
}

short shGetWiFiWEPMode(void)
{
	return srTCPRec.shWiFiWEPMode;
}

void vdSetWiFiWEPMode(short shWiFiWEPMode)
{
	srTCPRec.shWiFiWEPMode = shWiFiWEPMode;
}

short shGetWiFiWEPIndex(void)
{
	return srTCPRec.shWiFiWEPIndex;
}

void vdSetWiFiWEPIndex(short shWiFiWEPIndex)
{
	srTCPRec.shWiFiWEPIndex = shWiFiWEPIndex;
}

